<template>
  <el-pagination
    background
    :layout="layout"
    :page-sizes="pageSizes"
    :total="total"
    :current-page="currentPage"
    @size-change="sizeChange"
    @current-change="currentChange"
  >
  </el-pagination>
</template>

<script>
export default {
  name: "pagination",
  props: {
    total: {
      type: Number,
      required: true,
    },
    pageSize: {
      type: Number,
      required: true,
    },
    currentPage: {
      type: Number,
      required: true,
    },
    pageSizes: {
      type: Array,
      default() {
        return [10, 15, 30, 50];
      },
    },
    layout: {
      type: String,
      default: "prev, pager, next, sizes, total, jumper",
    }
  },
  methods: {
    sizeChange(val){
      this.$emit('size-change', val)
    },
    currentChange(val){
      this.$emit('current-change', val)
    }
  },
};
</script>

<style lang="less" scoped>
.el-pagination {
  margin-top: 20px;
}
</style>
